<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>修改商品信息</title>
</head>
<body>
<meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <!-- <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" /> -->
    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="./css/font.css">
    <link rel="stylesheet" href="./css/xadmin.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script type="text/javascript" src="./lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="./js/xadmin.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  
  <body>
    <div class="x-body"> 
        <form class="layui-form" action="../goodsListUpdate.do" method="post">
        	<div class="layui-form-item">
        		<label for="goodsname" class="layui-form-label">
                  	<span class="x-red">*</span>商品名称
              	</label>
              	<input type="hidden" value="${param.sid}" name="goodsId" />
              	<div class="layui-input-inline">
              		<input type="text" value="${param.sname}" name="goodsname" required="" lay-verify="required" autocomplete="off" class="layui-input">
              	</div>	
        	</div>
        	
        	<div class="layui-form-item">
              <label for="boardid" class="layui-form-label">
                  <span class="x-red">*</span>所属版块
              </label>
              <div class="layui-input-inline">
              	<select name="boardid" id="boardid" class="layui-input">
              		<option value="">请选择版块</option>
              	</select>
              </div>
          </div>
          
          <div class="layui-form-item">
              <label for="price" class="layui-form-label">
                  <span class="x-red">*</span>商品价格
              </label>
              <div class="layui-input-inline">
                  <input type="text" id="smoney" value="${param.smoney}" onBlur="checkPrice()" oninput="checkPrice()" name="price" class="layui-input">
              </div>
              <div class="layui-form-mid layui-word-aux">
                <span id="xsmoney" name="xusername">请输入价格</span>  	
              </div>
          </div>    
<%--           <div class="layui-form-item">
              <label for="goodsimage" class="layui-form-label">
                  <span class="x-red">*</span>商品图片
              </label>
              <div class="layui-input-inline">
                  <input type="file" value="${param.picture}" name="tupian">
              </div>
          </div> --%>
          
          <div class="layui-form-item">
              <label for="L_repass" class="layui-form-label">
              </label>
              <div class="layui-input-inline">
                  <input type="submit" id="tijiao" value="提交"  class="layui-btn" lay-submit="" >
              </div>
          </div>
      </form>
    </div>
</body>
<script type="text/javascript">
    	$(function(){
    		$("#smoney").on("blur",function(){
    			var reg =/^[0-9]+(.[0-9]{0,3})?$/;
        		var price=$("#smoney").val();
        		var b =reg.test(price);
        		if(b){
        			$("#xsmoney").html("√");
        		}else{
        			$("#xsmoney").html("价格格式不对");
        		}
        		
    		})
	
    	})
    </script>
<script type="text/javascript">
      function renderForm(){
    	  layui.use('form', function(){
    	  var form = layui.form;//高版本建议把括号去掉，有的低版本，需要加()
    	  form.render();
    	  });
    	  }
     $(function(){
		$.ajax({
		    url:"../getBoard.do",
			dataType:"json",
			success:function(result){
				$.each(result,function(index,item){
					$("#boardid").append("<option value='"+item.bid+"'>"+item.bname+"</option>");
				})
				renderForm(); //表单重新渲染，要不然添加完显示不出来新的option
			}
		})
	})
</script>
</html>